home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
14642
/
14642.xpi
/
chrome
/
content
/
createCategory.js
next >
Wrap
Text File
|
2009-09-14
|
2KB
|
48 lines
/* Copyright 2009, Boomtango.com. All Rights Reserved. */
/* createCategory.js
* Responsible for the create a category window
*/
Components.utils.import("resource://boomtango/app.js");
var mgr = {
onLoad: function(){},
onOK: function(){
var name = document.getElementById("name").value;
var keywords = document.getElementById("keywords").value;
var regex = document.getElementById("regex").checked;
var prompt = Components.
classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
if(!name.length){
prompt.alert(window, "Boomtango", boomtangoApp.getString("createc.error.noname"));
return false;
} else {
var types = boomtangoApp.tracker.types;
for(var x in types){
if(types.hasOwnProperty(x)){
if(types[x].name == name){
prompt.alert(window, "Boomtango", boomtangoApp.getString("createc.error.dupname"));
return false;
}
}
}
}
if(!keywords.length){
prompt.alert(window, "Boomtango", boomtangoApp.getString("createc.error.nokeywords"));
return false;
}
var id = boomtangoApp.tracker.createCategoryTracker(name, keywords, regex);
if(window.arguments && window.arguments.length){
window.arguments[0].type = id;
}
return true;
},
onRegexClick: function(){
var regex = document.getElementById("regex").checked;
document.getElementById("keyword_desc").
setAttribute("hidden", !regex);
}
};